﻿@model IEnumerable<WebDocDB.Models.Document>
@if (@Model.Any())
{
    foreach (var item in Model)
    {
        <div class="DocumentGroup">            
            <a href="#" class="Document" id="Document_@item.ID" onclick="selectDocument('@item.ID','@item.Link')">@item.ID</a>            
        </div>
    }
}
else
{
    <div class="DocumentGroup">
        <i>No Documents found</i>
    </div>
}

<script>
    var selectedDocumentLink = "";
    var selectedDocumentID = "";

    function selectDocument(documentID, documentLink)
    {
        //Clear documents style        
        $("[id^=Document_]").css({ 'font-weight': 'normal' });

        //Show the selected one       
        $('#Document_' + documentID).css({ 'font-weight': 'bold' });
        $('#btnDeleteDocument').show();        

        selectedDocumentLink = documentLink;
        selectedDocumentID = documentID;
    }
 </script>